package com.li.toolkit.utils;

import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author LiDong
 * @version 1.0.0
 * @createTime 2/19/2022 10:12 AM
 */
public final class UuidUtils {

    private static final Pattern COMPILE = Pattern.compile("-", Pattern.LITERAL);

    private UuidUtils() {
    }

    /**
     * 获取随机UUID
     *
     * @return String
     */
    public static String randomUuid() {
        return UUID.randomUUID().toString();
    }

    /**
     * 简化的UUID，去掉了横线
     *
     * @return String
     */
    public static String simpleUuid() {
        return COMPILE.matcher(UUID.randomUUID().toString()).replaceAll(Matcher.quoteReplacement(""));
    }


}
